package structural.flyweight;

/**
 * @ClassName: ConcreteFlyweight
 * @Description: 具体享元类
 * @Author: liu-hao
 * @Date: 2023-04-09 20:35
 * @Version: 1.0
 **/
public class ConcreteFlyweight implements Flyweight{
    private final String intrinsicState;

    // 添加final修饰，可保证享元对象的内部状态不可变
    // private final String intrinsicState;

    public ConcreteFlyweight(String intrinsicState) {
        this.intrinsicState = intrinsicState;
    }

    @Override
    public void operation() {
        System.out.println("ConcreteFlyweight: " + intrinsicState);
    }
}
